home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Macintosh Tracker 1.20 / source / Tracker Client Folder / Core 18⁄March⁄1994 / CVScrollBar.c < prev    next >
Encoding:
Text File  |  1993-06-06  |  10.2 KB  |  149 lines  |  [TEXT/KAHL]

  1.             CVScrollBar::DoMouseDown(MyEventRec Event)
  2.     {
  3.         long                Length;
  4.         LongPoint        MouseLoc;
  5.         MyBoolean        OutOfRange;
  6.         short                XorPosition;
  7.         MyBoolean        ImageXored;
  8.  
  9.         CurrentOperation = FindPart(MyGlobalToLocal(Event.Where));
  10.         switch (CurrentOperation)
  11.             {
  12.                 case mUpOne:
  13.                     if (VScrollable && Enabled)
  14.                         {
  15.                             do{
  16.                                     RedrawVBar();
  17.                                     if (CurrentOperation == mUpOne)
  18.                                         {
  19.                                             Owner->Hook(VScrollUpOne,0,0);
  20.                                         }
  21.                                     CurrentOperation = FindPart(MyGlobalToLocal(GetLongMouseLoc()));
  22.                                     if (CurrentOperation != mUpOne)
  23.                                         {
  24.                                             CurrentOperation = mNone;
  25.                                         }
  26.                                     RelinquishCPU();
  27.                                     SendIdleToAll();
  28.                                 } while (WaitMouseUp());
  29.                             CurrentOperation = mNone;
  30.                             RedrawVBar();
  31.                         }
  32.                     break;
  33.                 case mUpPage:
  34.                     if (VScrollable && Enabled)
  35.                         {
  36.                             do{
  37.                                     RedrawVBar();
  38.                                     if (CurrentOperation == mUpPage)
  39.                                         {
  40.                                             Owner->Hook(VScrollUpPage,0,0);
  41.                                         }
  42.                                     CurrentOperation = FindPart(MyGlobalToLocal(GetLongMouseLoc()));
  43.                                     if (CurrentOperation != mUpPage)
  44.                                         {
  45.                                             CurrentOperation = mNone;
  46.                                         }
  47.                                     RelinquishCPU();
  48.                                     SendIdleToAll();
  49.                                 } while (WaitMouseUp());
  50.                             CurrentOperation = mNone;
  51.                             RedrawVBar();
  52.                         }
  53.                     break;
  54.                 case mDownOne:
  55.                     if (VScrollable && Enabled)
  56.                         {
  57.                             do{
  58.                                     RedrawVBar();
  59.                                     if (CurrentOperation == mDownOne)
  60.                                         {
  61.                                             Owner->Hook(VScrollDownOne,0,0);
  62.                                         }
  63.                                     CurrentOperation = FindPart(MyGlobalToLocal(GetLongMouseLoc()));
  64.                                     if (CurrentOperation != mDownOne)
  65.                                         {
  66.                                             CurrentOperation = mNone;
  67.                                         }
  68.                                     RelinquishCPU();
  69.                                     SendIdleToAll();
  70.                                 } while (WaitMouseUp());
  71.                             CurrentOperation = mNone;
  72.                             RedrawVBar();
  73.                         }
  74.                     break;
  75.                 case mDownPage:
  76.                     if (VScrollable && Enabled)
  77.                         {
  78.                             do{
  79.                                     RedrawVBar();
  80.                                     if (CurrentOperation == mDownPage)
  81.                                         {
  82.                                             Owner->Hook(VScrollDownPage,0,0);
  83.                                         }
  84.                                     CurrentOperation = FindPart(MyGlobalToLocal(GetLongMouseLoc()));
  85.                                     if (CurrentOperation != mDownPage)
  86.                                         {
  87.                                             CurrentOperation = mNone;
  88.                                         }
  89.                                     RelinquishCPU();
  90.                                     SendIdleToAll();
  91.                                 } while (WaitMouseUp());
  92.                             CurrentOperation = mNone;
  93.                             RedrawVBar();
  94.                         }
  95.                     break;
  96.                 case mVBox:
  97.                     if (VScrollable && Enabled)
  98.                         {
  99.                             if ((Event.Modifiers & optionKey) != 0)
  100.                                 {
  101.                                     short        OldMouseLoc = -32767;
  102.  
  103.                                     ImageXored = False;
  104.                                     /* setting up drawing environment */
  105.                                     SetUpPort();
  106.                                     Length = PageDownZoneExt.y + PageUpZoneExt.y;
  107.                                     do{
  108.                                             static LongPoint    VXorBoxExt = {14,16};
  109.  
  110.                                             /* removing any image already there */
  111.                                             do
  112.                                                 {
  113.                                                     MouseLoc = MyGlobalToLocal(GetLongMouseLoc());
  114.                                                     RelinquishCPU();
  115.                                                     SendIdleToAll();
  116.                                                 } while ((MouseLoc.y - 16 - 8 == OldMouseLoc) && WaitMouseUp());
  117.                                             SetUpPort();
  118.                                             Window->ResetPen();
  119.                                             Window->SetPenMode(srcXor);
  120.                                             Window->SetPattern(dkGray);
  121.                                             if (ImageXored)
  122.                                                 {
  123.                                                     Window->LFrameRect(LongPointOf(Extent.x - 16 + 1,
  124.                                                         XorPosition + 16),VXorBoxExt);
  125.                                                     ImageXored = False;
  126.                                                 }
  127.                                             /* finding new image position */
  128.                                             OutOfRange = False;
  129.                                             OldMouseLoc = MouseLoc.y - 16 - 8;
  130.                                             XorPosition = OldMouseLoc;
  131.                                             if ((MouseLoc.x < (Extent.x - 16 - 24))
  132.                                                 || (MouseLoc.x > (Extent.x + 24)))
  133.                                                 {
  134.                                                     OutOfRange = True;
  135.                                                 }
  136.                                             if (XorPosition < 0)
  137.                                                 {
  138.                                                     XorPosition = 0;
  139.                                                 }
  140.                                             if (XorPosition > Length)
  141.                                                 {
  142.                                                     XorPosition = Length;
  143.                                                 }
  144.                                             /* putting new image position */
  145.                                             if (!OutOfRange)
  146.                                                 {
  147.                                                     Window->LFrameRect(LongPointOf(Extent.x - 16 + 1,
  148.                                                         XorPosition + 16),VXorBoxExt);
  149.